//
//  CXMBShow.swift
//  vr_web
//
//  Created by 李旭峰 on 2020/7/13.
//

import UIKit
import Foundation

class CXMBShow: NSObject {
    
    /// 创建MB指示器
    ///
    /// - Parameters:
    ///   - message: 信息
    ///   - view: 所在的view
    @objc static func openIndicator(message:String?, view:UIView?) {
//        MBProgressHUD.showMessage(message: message, toView: view != nil ? view : CXMBShow.currentView())
    }
    
    ///关闭指示器
    @objc static func colseIndicator(view:UIView? = nil) {
//        MBProgressHUD.hideHUDForView(view: view != nil ? view : CXMBShow.currentView())
    }
    
    
    /// 提示信息
    ///
    /// - Parameter message: 提示信息的文本
    @objc static func showMessage(_ message:String) {
//        DebugUIManager.ShareInstance().addDebug(message)
//        DispatchQueue.main.async {
//            if message == "Invalid" { return }
//            if message.count >= 100 {
//                UIApplication.shared.keyWindow?.displayMessage(message: "系统异常，请重试。")
//            }else if message.count >= 1{
//                UIApplication.shared.keyWindow?.displayMessage(message: message)
//            }
//        }
    }
    
    class func currentController() -> UIViewController? {
        if UIApplication.shared.keyWindow == nil {
            return nil
        }
        return nil
    }
    
    
    class func currentView() -> UIView {
        let window = UIApplication.shared.keyWindow!
        return window
    }
}

